package com.example.horizonserver.common.context;

public class BaseContext {
    private static final ThreadLocal<Integer> currentUser = new ThreadLocal<>();
    private static final ThreadLocal<Integer> currentRole = new ThreadLocal<>();

    public static void setCurrentId(Integer id) {
        currentUser.set(id);
    }

    public static Integer getCurrentId() {
        return currentUser.get();
    }

    public static void setCurrentRole(Integer role) {
        currentRole.set(role);
    }

    public static Integer getCurrentRole() {
        return currentRole.get();
    }

    public static void removeCurrentId() {
        currentUser.remove();
    }

    public static void removeCurrentRole() {
        currentRole.remove();
    }
}

